package svc

import (
	"github.com/blog-zero/rpc/model/omsmodel"
	"github.com/blog-zero/rpc/oms/internal/config"
	"github.com/zeromicro/go-zero/core/stores/sqlx"
)

type ServiceContext struct {
	Config config.Config

	OmsCartItemModel       omsmodel.OmsCartItemModel
	OmsCompanyAddressModel omsmodel.OmsCompanyAddressModel
	// OmsOrderItemModel           omsmodel.OmsOrderItemModel
	// OmsOrderModel               omsmodel.OmsOrderModel
	// OmsOrderOperateHistoryModel omsmodel.OmsOrderOperateHistoryModel
	// OmsOrderReturnApplyModel    omsmodel.OmsOrderReturnApplyModel
	// OmsOrderReturnReasonModel   omsmodel.OmsOrderReturnReasonModel
	OmsOrderSettingModel omsmodel.OmsOrderSettingModel
}

func NewServiceContext(c config.Config) *ServiceContext {
	sqlConn := sqlx.NewMysql(c.Mysql.Datasource)
	return &ServiceContext{
		Config: c,

		OmsCartItemModel:       omsmodel.NewOmsCartItemModel(sqlConn),
		OmsCompanyAddressModel: omsmodel.NewOmsCompanyAddressModel(sqlConn),
		// OmsOrderItemModel:           omsmodel.NewOmsOrderItemModel(sqlConn),
		// OmsOrderModel:               omsmodel.NewOmsOrderModel(sqlConn),
		// OmsOrderOperateHistoryModel: omsmodel.NewOmsOrderOperateHistoryModel(sqlConn),
		// OmsOrderReturnApplyModel:    omsmodel.NewOmsOrderReturnApplyModel(sqlConn),
		// OmsOrderReturnReasonModel:   omsmodel.NewOmsOrderReturnReasonModel(sqlConn),
		OmsOrderSettingModel: omsmodel.NewOmsOrderSettingModel(sqlConn),
	}
}
